<?php include("connection.php"); ?>
<?php
$req=$_REQUEST['request_id'];
$q=mysql_query("SELECT * FROM requests where idRequests='$req' ");
$row=mysql_fetch_array($q);
$option=explode(",",$row['options']);
//print_r($option);
if (!empty($option[0])) $opt=$option[0]; else $opt='';
if (!empty($option[1])) $opt2=$option[1]; else $opt2='';
if (!empty($option[2])) $opt3=$option[2]; else $opt3='';
//echo $opt;
//$opt1
//$opt1
$exc=explode(",",$row['exc_arl']);
$inc=explode(",",$row['inc_arl']);
$alt=$row['num_alt'];
$sid=$row['sid'];
$trav=explode(',',$row['ptc']);
$adt=$trav[0];
$chd=$trav[1];
$inf=$trav[2];
$airline_option=$row['arl_opt'];
$status=$row['status'];
$con_city_cod=explode(",",$row["con_city_cod"]);

function get_airline_name($str)
{
	$query = mysql_query("SELECT airline_name from airline_new WHERE airline_code='$str' limit 0,1");
	$row=mysql_fetch_array($query);
	echo $row[0];
	
}
function get_airport_name($str)
{
    $query = mysql_query("SELECT name,airport_code from airport_code WHERE airport_code='$str' limit 0,1");
    $row=mysql_fetch_array($query);
    echo $row[0]."($row[1])";
}
?>
<style type="text/css">
<!--
body, td, th {
	font-family: segoe UI, tahoma, trebuchet MS, verdana;
	font-size: 12px;
	color: #000;
}
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
a:link {
	color: #03C;
	text-decoration: none;
}
a:visited {
	text-decoration: none;
	color: #03C;
}
a:hover {
	text-decoration: none;
	color: #03C;
}
a:active {
	text-decoration: none;
	color: #03C;
}
.checkbox {
}
-->
label {
	width: 10em;
	float: left;
}
label.error {
	float: none;
	color: red;
	padding-left: .5em;
	vertical-align: top;
}
</style>

<div>
<form name="update_request" id="update_request" action="make_request.php" method="post">
  <br />
  <table width="589" border="0" align="center" cellpadding="0" cellspacing="1">
    <tr>
      <td width="587"><table width="588" border="0" cellspacing="1" cellpadding="4">
        <tr>
          <td colspan="6" bgcolor="#F8F8F8"><strong>&nbsp;&nbsp;&raquo; Fare Option</strong></td>
          </tr>
        <tr>
          <td width="23" bgcolor="#F8F8F8"><input type="radio" <?php if ($opt=='U') echo "Checked='Checked'"; else ''; ?> name="option" value="U" align="absmiddle" class="required" /></td>
          <td width="196" bgcolor="#F8F8F8">Published and Phase 1 Securate only</td>
          <td width="20" bgcolor="#F8F8F8"><input type="radio" <?php if ($opt=='V') echo "Checked='Checked'"; else ''; ?> name="option"  value="V" align="absmiddle" class="required" /></td>
          <td width="148" bgcolor="#F8F8F8">Phase 1 Securate only</td>
          <td width="20" bgcolor="#F8F8F8"><input type="radio" <?php if ($opt=='N') echo "Checked='Checked'"; else ''; ?> name="option" value="N" align="absmiddle" class="required" /></td>
          <td width="126" bgcolor="#F8F8F8">Securate only</td>
          </tr>
        
        <tr> 
          <td bgcolor="#F8F8F8" colspan="6"><strong>&nbsp;&nbsp;&raquo; Flight Option</strong></td>
          </tr>
        
        <tr> 
          <td bgcolor="#F8F8F8"><input name="option2[]" <?php if ($opt2=='I') echo "Checked='Checked'"; else ''; ?> id="opt1" type="checkbox" value="I" align="absmiddle" onclick="check12(this.id)" /></td>
          <td bgcolor="#F8F8F8">Direct Flights</td>
          <td bgcolor="#F8F8F8"><input name="option2[]" <?php if ($opt2=='4') echo "Checked='Checked'"; else ''; ?> id="opt2" type="checkbox" value="4" align="absmiddle" onclick="check12(this.id)"  /></td>
          <td bgcolor="#F8F8F8">Exclude Airport Connection</td>
          <td bgcolor="#F8F8F8"><input name="option2[]" <?php if ($opt2=='K') echo "Checked='Checked'"; else ''; ?> id="opt3" type="checkbox" value="K" align="absmiddle" onclick="check12(this.id)"  /></td>
          <td bgcolor="#F8F8F8">Non Stop Flights</td>
          </tr>
        
        <tr> 
          <td bgcolor="#F8F8F8"><input name="option2[]" <?php if ($opt2=='L') echo "Checked='Checked'"; else ''; ?> id="opt4" type="checkbox" value="L" align="absmiddle" onclick="check12(this.id)"  /></td>
          <td bgcolor="#F8F8F8">Single Connection or Better</td>
          <td bgcolor="#F8F8F8"><input name="option2[]" <?php if ($opt2=='R') echo "Checked='Checked'"; else ''; ?> id="opt5" type="checkbox" value="R" align="absmiddle" onclick="check12(this.id)"  /></td>
          <td bgcolor="#F8F8F8">Exclude Double Connection</td>
          <td bgcolor="#F8F8F8"><input name="option2[]" <?php if ($opt2=='S') echo "Checked='Checked'"; else ''; ?> id="opt6" type="checkbox" value="S" align="absmiddle" onclick="check12(this.id)" /></td>
          <td bgcolor="#F8F8F8">Exclude Incidental Stops</td>
          </tr>
          <tr>
              <td bgcolor="#F8F8F8" colspan="6"><strong>&nbsp;&nbsp;&raquo; Connection City Option</strong></td>
            </tr>
            <tr>
        <td height="28" bgcolor="#F3F3F3"  colspan="6"><strong>&nbsp;&nbsp;&raquo; Connection Cities</strong></td>
      </tr>
      <tr>
        <td colspan="6"><table width="100%" border="0" cellspacing="1" cellpadding="4" >
            <tr>
              <td  bgcolor="#F8F8F8" id="con_cit_td"><select id="con_city_cod" name="con_city_cod">
               <?php
        foreach($con_city_cod as $e)
        {
            if($e!=='')
                {
            ?>
            
                <option value="<?php echo $e; ?>" class="selected"  >
                <?php get_airport_name($e); ?>
                </option>
                <?php
                }
        }
        ?>
                </select>
                &nbsp;</td>
            </tr>
          </table></td>
      </tr>
        <tr> 
          <td bgcolor="#F8F8F8" colspan="6"><strong>&nbsp;&nbsp;&raquo; Nearby Option</strong></td>
          </tr>
        
        <tr> 
          <td bgcolor="#F8F8F8"><input name="option3[]" <?php if ($opt3=='G') echo "Checked='Checked'"; else ''; ?> type="checkbox" value="G" align="absmiddle"  /></td>
          <td bgcolor="#F8F8F8"  colspan="5">Multiple Airport</td>
          </tr>
        
        </table></td>
    </tr>
  </table>
  <table width="591" border="0" align="center" cellpadding="0" cellspacing="1">
    <tr>
      <td width="589"><table width="590" border="0" cellspacing="1" cellpadding="4">
        <tr>
          <td width="203" bgcolor="#F8F8F8"><strong>&raquo; Adult Type</strong></td>
          <td width="169" bgcolor="#F8F8F8"><strong>&raquo; Child Type</strong></td>
          <td width="190" bgcolor="#F8F8F8"><strong>&raquo; Infant Type</strong></td>
          </tr>
        <tr>
          <td bgcolor="#F8F8F8"><table width="90%" border="0" cellspacing="0" cellpadding="4">
            <tr>
              <td width="20"><input type="radio" name="adt" id="radio" value="ADT"   class="required" <?php echo ($adt == "ADT") ? "checked='checked'" : ""; ?> /></td>
              <td width="73">ADT</td>
              <td width="20"><input type="radio" name="adt" id="radio2" value="JCB"  class="required" <?php echo ($adt == "JCB") ? "checked='checked'" : ""; ?> /></td>
              <td width="83">JCB</td>
              </tr>
            </table></td>
          <td bgcolor="#F8F8F8"><table width="90%" border="0" cellspacing="0" cellpadding="4">
            <tr>
              <td width="20"><input type="radio" name="chd" id="radio3" value="CNN"  class="required" <?php echo ($chd == "CNN") ? "checked='checked'" : ""; ?> /></td>
              <td width="70">CNN</td>
              <td width="20"><input type="radio" name="chd" id="radio4" value="JNN"  class="required"   <?php echo ($chd == "JNN") ? "checked='checked'" : ""; ?>/></td>
              <td width="78">JNN</td>
              </tr>
            </table></td>
          <td bgcolor="#F8F8F8"><table width="81%" border="0" cellspacing="0" cellpadding="4">
            <tr>
              <td width="20"><input type="radio" name="inf" id="radio5" value="INF"  class="required"  <?php echo ($inf == "INF") ? "checked='checked'" : ""; ?> /></td>
              <td width="90">INF</td>
              <td width="20"><input type="radio" name="inf" id="radio6" value="JNF"  class="required"  <?php echo ($inf == "JNF") ? "checked='checked'" : ""; ?> /></td>
              <td width="80">JNF</td>
              </tr>
            </table></td>
          </tr>
        </table></td>
    </tr>
  </table>
  <table width="593" border="0" align="center" cellpadding="0" cellspacing="1">
    <tr>
      <td width="591"><table width="591" border="0" cellspacing="1" cellpadding="4">
        <tr>
          <td width="116" bgcolor="#F8F8F8"><strong>&nbsp;&nbsp;&raquo; Airline Incl. Mode</strong></td>
          <td width="456" bgcolor="#F8F8F8"><table width="240" border="0" cellspacing="0" cellpadding="4">
            <tr>
              <td width="20"><input type="radio" name="airline_option" id="airline_option" value="A"   <?php echo ($airline_option == 'A') ? "checked='checked'" : ""; ?> /></td>
              <td width="51">Preffered</td>
              <td width="20"><input type="radio" name="airline_option" id="airline_option2" value="B" <?php echo ($airline_option == 'B') ? "checked='checked'" : ""; ?>   /></td>
              <td width="54">Exclusive</td>
              <td width="20"><input type="radio" name="airline_option" id="airline_option1" value="N" <?php echo ($airline_option == "N") ? "checked='checked'" : ""; ?> /></td>
              <td width="50">None</td>
              </tr>
            </table></td>
          </tr>
        </table></td>
    </tr>
  </table>
  <table width="593" border="0" align="center" cellpadding="0" cellspacing="1"  id="a1">
    <tr>
      <td width="591" height="28" bgcolor="#F3F3F3"><strong>&nbsp;&nbsp;&raquo; Include Airlines</strong></td>
    </tr>
    <tr>
      <td><table width="592" border="0" cellspacing="1" cellpadding="4">
          <tr>
            <td width="582" bgcolor="#F8F8F8" id="c1"><select id="include" name="include">
                <?php
		foreach($inc as $i)
		{ 
			if($i!=='')
				{
			?>
                <option value="<?php echo $i; ?>" class="selected"  >
                <?php get_airline_name($i); ?>
                </option>
                <?php
				}
		}
		?>
              </select>
              &nbsp;</td>
          </tr>
        </table></td>
    </tr>
  </table>
  <table width="593" border="0" align="center" cellpadding="0" cellspacing="1"  id="b1">
    <tr>
      <td width="591" height="28" bgcolor="#F3F3F3"><strong>&nbsp;&nbsp;&raquo; Exclude Airlines</strong></td>
    </tr>
    <tr>
      <td><table width="592" border="0" cellspacing="1" cellpadding="4">
          <tr>
            <td width="582" bgcolor="#F8F8F8"  id="c2"><select id="exclude" name="exclude">
                <?php
		foreach($exc as $e)
		{
			if($e!=='')
				{
			?>
            
                <option value="<?php echo $e; ?>" class="selected"  >
                <?php get_airline_name($e); ?>
                </option>
                <?php
				}
		}
		?>
              </select></td>
          </tr>
        </table></td>
    </tr>
  </table>
  <table width="594" border="0" align="center" cellpadding="0" cellspacing="1">
    <tr>
      <td width="592"><table width="593" border="0" cellspacing="1" cellpadding="4">
        <tr>
          <td width="56" bgcolor="#F8F8F8"><strong>Alternate </strong></td>
          <td width="148" bgcolor="#F8F8F8"><input name="alt" type="text" id="textfield" value="<?php echo $alt; ?>" class="required number" /></td>
          <td width="20" bgcolor="#F8F8F8"><strong>SID</strong></td>
          <td width="126" bgcolor="#F8F8F8"><table width="36%" border="0" cellspacing="0" cellpadding="4">
            <tr>
              <td width="20"><input type="radio" name="sid" id="radio7" value="XSY"  class="required" <?php echo ($sid == "XSY") ? "checked='checked'" : ""; ?> /></td>
              <td width="33">XSY</td>
              <td width="22"><input type="radio" name="sid" id="radio9" value="33J"  class="required" <?php echo ($sid == "33J") ? "checked='checked'" : ""; ?> /></td>
              <td width="22">33J</td>
            </tr>
          </table></td>
          <td width="52" bgcolor="#F8F8F8"><strong>Status</strong></td>
          <td width="136" bgcolor="#F8F8F8"><table width="31%" border="0" cellspacing="0" cellpadding="4">
            <tr>
              <td width="29"><input type="radio" name="status" id="radio15" value="1"  class="required"  <?php echo ($status == "1") ? "checked='checked'" : ""; ?> /></td>
              <td width="59">Active</td>
              <td width="27"><input type="radio" name="status" id="radio16" value="0"  class="required"  <?php echo ($status == "0") ? "checked='checked'" : ""; ?> /></td>
              <td width="66">Paused</td>
            </tr>
          </table></td>
          </tr>
        </table></td>
    </tr>
  </table>
  <table width="595" border="0" align="center" cellpadding="0" cellspacing="1">
    <tr>
      <td width="593" align="center" bgcolor="#FFF5D7">
      <input type="text" value="<?php echo $_REQUEST['config_id'];?>" name="config_id" style="display:none;" />
      <input type="text" value="<?php echo $_REQUEST['request_id']?>" name="request_id"  style="display:none;"/>
      <input type="text" name="button" value="update" id="button" style="display:none;"/>
      <input name="button" type="button"   style="background-color:#cf0104; color:#FFF; font-family:segoe Ui; width:102px;" value="update" onclick="check();" /></td>
    </tr>
  </table>
</form>
</div>
